package com.wuyan.locationdog.ui.device


import androidx.fragment.app.FragmentManager
import com.arcsoft.commonbase.base.BaseBindingActivity
import com.arcsoft.commonbase.constant.Constants.permissions
import com.arcsoft.commonbase.widgets.dialog.CommonDialog
import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.PermissionUtils
import com.wuyan.locationdog.R
import com.wuyan.locationdog.databinding.FragmentContainerBinding
import com.wuyan.locationdog.ui.map.DeviceHomeFragment


class OneDeviceActivity : BaseBindingActivity<FragmentContainerBinding>() {



    override fun initData() {
        BarUtils.transparentStatusBar(this)


        val fragmentManager: FragmentManager = supportFragmentManager
        val deviceDetailFragment = DeviceHomeFragment()
// 创建并添加第一个Fragment
        fragmentManager.beginTransaction()
            .add(R.id.frameLayout, deviceDetailFragment)
            .commit()

        PermissionUtils.permission(*permissions)
            .callback { isAllGranted, granted, deniedForever, denied ->
                if (isAllGranted) {

                } else {
                    CommonDialog(mActivity,"打开权限","请打开定位/相机/文件存储权限"){
                        AppUtils.launchAppDetailsSettings()
                    }.show()
                }
            }
            .request()
    }


}